<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
import Edit from "./../edit/index";
import ViewList from "./../viewList/index";
import Inventory from "./../inventory/index";
export default {
    mixins: [
        Vue.prototype.$vFN.Mixins.Base,
        Vue.prototype.$vFN.Mixins.Page,
        Vue.prototype.$vFN.Mixins.Table,
    ],
    components: {
        ShareQrcodeBox: async () =>
            Vue.extend(
                await Vue.prototype.$vFN.Components.Base.ShareQrcodeBox()
            ),
    },
    data() {
        return {
            appWindow: window,
            // 页面接口地址
            apiUrl: {
                list: "admin/active/activeProducts",
                delete: "admin/active/finishLevel",
            },
            // 表格查询数据
            mixinTable_tableSearchData: {
                name: "",
            },
            // 表格数据
            tableData: [],
            // 表格数据删除展示结构
            tableDeleteConfig: {
                columns: [
                    {
                        label: "分类名称",
                        prop: "name",
                        type: "",
                    },
                    {
                        label: "绑定门店数",
                        prop: "count",
                        type: "",
                    },
                ],
            },
        };
    },
    methods: {
         showCode(_id) {
            this.$refs["shareQrcodeBox" + _id].init({
                config: {
                    path: "/packGoodsDetail/groupBuying/index",
                    query: {
                        id: _id,
                    },
                },
            });
        },
        // 手动结束
        async finishLevel(_id) {
            let res = await this.$vFN.Http.post({
                url: "admin/active/finishLevel",
                data: {
                    level_id: _id
                }
            }, window);
            this.$vFN.Tools.messageSuccess("操作成功");
            this.mixinTable_refreshData();
        },
        // 库存明细
        async inventory(item) {
            Inventory.init({
                id: item.id,
            })
        },
        // 打开添加/修改
        viewList(params_) {
            ViewList.init({
                mixinEdit_parent: this,
                id: params_.id,
            });
        },
        editBoxOpen(params_) {
            Edit.init({
                mixinEdit_parent: this,
                mixinEdit_editType: params_.type,
                id: params_.id,
            })
        },
        // 初始化
        async init() {
            this.mixinTable_refreshData();
        },
    },
    mounted() {
        this.init();
    },
    activated() {},
};
</script>